# Copyright (C) 2010 Zajcev Evgeny <zevlg@yandex.ru>

# Stuff for C-speed
cdef enum:
    NODE = 0, WAY  = 1, RELATION = 2
    CNODE = 3                           # special for marks, saves
    ND, MEMBER, PARTIAL, UNKNOWN

cdef struct tinfo:
    int type                            # NODE, WAY, RELATION, etc
    char *s, *e, *h                     # start, end and head ending

cdef struct latlon:
    double lat, lon

cdef enum: ANONE, AINT, ADBL, ASTR, AEND
cdef union attrval:
    int integer
    double floating
    char* string
cdef struct tagattr:
    int type                            # ANONE, AINT, etc
    char* name
    int nlen
    attrval value

# callback types
ctypedef void (*cbfunc)(object, tinfo*)
ctypedef bint (*mapifunc)(object, tinfo*, void*)
ctypedef bint (*relfunc)(object, tinfo*, int, int)

cdef extern from "string.h":
    char* strnstr(char*, char*, size_t)
    size_t strlen(char*)
    void* memmove(void*, void *, size_t)
    void* memcpy(void*, void*, size_t)
    void* memset(void*, int, size_t)
    int memcmp(void*, void*, size_t)

cdef extern from "unistd.h":
    size_t read(int, void*, size_t)
    size_t write(int, void*, size_t)

cdef extern from "stdlib.h":
    long strtol(char*, char**, int)
    double strtod(char*, char**)
    void* malloc(size_t)
    void free(void*)

cdef extern:
    void rdahead(int fd)
